// 1. 导入创建容器对象的函数  createStore    create 创建  store 容器仓库
import {createStore, applyMiddleware, combineReducers} from 'redux';
import thunk from 'redux-thunk';
import renqiReducer from './reducers/renqiReducer';
import zanReducer from './reducers/zanReducer';
import { composeWithDevTools } from 'redux-devtools-extension'

//2. 声明数据的初始值    初始值可以是任意类型
//合并 reducer 函数
let reducer = combineReducers({
    zan: zanReducer,
    renqi: renqiReducer,
})

//3. 创建容器对象  state 状态值   action 操作对象 {type: 'jia', data: 100}   {type: 'jian', data: 2}
let store = createStore(reducer, composeWithDevTools(applyMiddleware(thunk)));

//4. 暴露数据
export default store;






















//一. 获取 redux 中的状态
// console.log(store.getState());

//二. dispatch  分发任务 修改状态
// store.dispatch({type: 'jia', data: 1});
// store.dispatch({type: 'jia', data: 1});
// store.dispatch({type: 'jian', data: 20});

// console.log(store.getState());